package com.jiazhong.basic.pack0517;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class DemoB {
    public static void main(String[] args) {
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            System.out.println("驱动类没有找到");
        }
        try {
            String url = "jdbc:mysql:///jiazhong_2025_2";
            String user = "root";
            String password = "a123456";
            Connection conn = DriverManager.getConnection(url, user, password);
            String sql = "create table k(id int ,name varchar(20))";
            PreparedStatement ps = conn.prepareStatement(sql);
            boolean b = ps.execute();
            System.out.println(b);
        } catch (SQLException e) {
            System.out.println(e.getMessage());
        }

    }
}
